Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Sep 2015 18:52:54 +0000
From:      "Pokala, Ravi" <rpokala@panasas.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: bus_.*_resource() and rid
Message-ID:  <D22ED71B.146AE6%rpokala@panasas.com>
In-Reply-To: <3440562.CxbPY93XVj@ralph.baldwin.cx>
References:  <D214E963.145154%rpokala@panasas.com> <1637146.Rv3dkk0gMi@ralph.baldwin.cx> <D22E9D9D.146A5C%rpokala@panasas.com> <3440562.CxbPY93XVj@ralph.baldwin.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
-----Original Message-----
From: John Baldwin <jhb@freebsd.org>
Date: 2015-09-28, Monday at 11:09
To: Ravi Pokala <rpokala@panasas.com>
Cc: Francois Tigeot <ftigeot@wolfpond.org>, "cem@FreeBSD.org"
<cem@freebsd.org>, "freebsd-hackers@freebsd.org"
<freebsd-hackers@freebsd.org>
Subject: Re: bus_.*_resource() and rid

>Ah, I did mean to include 'struct resource_i' as part of 'struct
>resource'.
>They are really stored as the same structure, and you can use
>rman_get_rid()
>on a struct resource.

Okay, I think I see how that works.

>> I have a one-line change to dump_rman() to include the RID along w/ the
>> start and end address. That at least got me what I was interested in
>>from
>> ddb.
>
>Neat, can you share that?

It's a very complicated diff. ;-)

--- sys/kern/subr_rman.c	(revision 288339)
+++ sys/kern/subr_rman.c	(working copy)
@@ -1051,7 +1051,7 @@
 				devname =3D "nomatch";
 		} else
 			devname =3D NULL;
-		db_printf("    0x%lx-0x%lx ", r->r_start, r->r_end);
+		db_printf("    0x%lx-0x%lx (%d)", r->r_start, r->r_end, r->r_rid);
 		if (devname !=3D NULL)
 			db_printf("(%s)\n", devname);
 		else


>> As for `devinfo', it looks like (struct u_resource) and (struct u_rman)
>> don't include the RID either:
>
>Fooey.  That would be a bit of a PITA to fix then.

Yeah. Alas!

>So there's actually a 'resource_list_add_next()' that bus drivers can use
>that
>does this, but that doesn't help you in this case. :(

Yeah, looks like it needs a (struct resource_list *), which I don't know
how to get.

Hmm... perhaps:

    struct resource_list *rl =3D
bus_get_resource_list(device_get_parent(dev), dev);
    rid =3D resource_list_add_next(rl, SYS_RES_IOPORT, start, end, count);

I'll try that.

Thanks!

-Ravi




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D22ED71B.146AE6%rpokala>